#ifndef MYDBEXEC_H
#define MYDBEXEC_H

#include <QObject>
class QSqlDatabase;
class MyDBExec : public QObject
{
    Q_OBJECT
public:
    explicit MyDBExec(QString connectName,QObject *parent = nullptr);
    bool getFreeState();//获取是否空闲
    void setFreeState(bool state);//设置空闲
    bool userLogin(QString username,QString password);
    bool receiveMessage(int boardid, double tem, double hum1, double light, double press, double hum2, bool water1, bool water2);
    bool deviceLogin( QString index,QString password);
    bool searchTodayMessage(QString device_id,QJsonArray &arr);

    bool  userGetMyDeviceName(QString username,QJsonArray &arr);

protected:
    bool freeState = true;//默认是空闲的
   void connectToDB(QString connectName = QString());
   QSqlDatabase * db;

signals:

public slots:
};

#endif // MYDBEXEC_H
